import { FormRule } from 'tdesign-vue-next';
import { ref } from 'vue';
import { PrimaryTableCol, TableRowData } from 'tdesign-vue-next';

export const INIT_DATA: any = { sn: '', dev_name: '', time: [] };

export const list = ref([
  { label: 'GA1400启用禁用', value: false, key: 'enable', type: 'SwitchView' },
  { label: '目标服务器地址', value: '', key: 'server_adr', type: 'InputView', placeholder: '请输入目标服务器地址', clearable: true },
  { label: '目标服务器端口', value: '', key: 'server_port', type: 'InputView', placeholder: '请输入目标服务器端口', clearable: true },
  { label: '用户名', value: '', key: 'username', type: 'InputView', placeholder: '请输入用户名', clearable: true },
  { label: '密码', value: '', key: 'password', type: 'InputView', inputType: 'password', placeholder: '请输入密码', clearable: true },
]);

export const FORM_RULES: Record<string, FormRule[]> = {
  enable: [{ required: true, message: '请选择', trigger: 'blur' }],
  server_adr: [{ required: true, message: '请输入目标服务器地址', trigger: 'blur' }],
  server_port: [{ required: true, message: '请输入目标服务器端口', trigger: 'blur' }],
};

export const columns: PrimaryTableCol<TableRowData>[] = [
  { colKey: 'dev_name', title: '设备名称', align: 'center' },
  { colKey: 'enable', title: 'GA1400启用禁用', align: 'center' },
  { colKey: 'connect_status', title: '连接状态', align: 'center' },
  { colKey: 'opt', title: '操作', fixed: 'right', align: 'center' },
];
